package com.sf.iisp.bind.biz;

import java.util.Map;

import com.sf.iisp.BindingException;
import com.sf.iisp.bind.domain.BindAll;
import com.sf.iisp.bind.domain.BindingRecord;
import com.sf.iisp.bind.domain.MessageHead;
import com.sf.iisp.bind.domain.ReceiveBindingInfo;
import com.sf.iisp.bind.domain.ReturnBindingInfo;
import com.sf.iisp.bind.helper.ResponseMessage;
import com.sf.novatar.base.dao.IPage;
import com.sf.novatar.base.domain.RequestParams;

/**
 * 绑定号码基础服务
 * Created by qi on 16-7-1.
 */
public interface BindingBiz {

    /**
     * 绑定号码
     *
     * @param courierPhone  收派员绑定的号码
     * @param customerPhone 客户绑定的号码
     * @param head          消息头
     * @return 虚拟号码
     * @throws BindingException
     */
    public ResponseMessage bind(String courierPhone, String customerPhone, MessageHead head) throws BindingException;

    /**
     * 绑定号码
     *
     * @param courierPhone  收派员绑定的号码
     * @param customerPhone 客户绑定的号码
     * @param virtualNo     虚拟号码
     * @return 虚拟号码
     * @throws BindingException
     */
    public String bind(String courierPhone, String customerPhone, String virtualNo) throws BindingException;

    /**
     * 获取虚拟编号
     *
     * @param courierPhone  收派员电话
     * @param customerPhone 客户电话
     * @param virtualNo     虚拟号码
     * @return
     * @throws BindingException
     */
    public String getVirtualNo(String courierPhone, String customerPhone, String virtualNo)
            throws BindingException;

    /**
     * 绑定号码
     *
     * @param phone  收派员绑定的号码
     * @param phone1 客户绑定的号码
     * @param time   失效时间
     * @return 虚拟号码
     * @throws BindingException
     */
    public String bind(String phone, String phone1, long time) throws BindingException;

    /**
     * 绑定号码(批量)
     *
     * @param numbers 号码表
     * @return 虚拟号码列表, key=number,value=virtualNumber
     * @throws BindingException
     */
    public Map<String, String> bind(Map<String, String> numbers) throws BindingException;

    /**
     * 绑定号码
     *
     * @param rb ＳＧＳ报文
     * @return 虚拟号码
     * @throws BindingException
     */
    @Deprecated
    public String bind(ReceiveBindingInfo rb) throws BindingException;

    /**
     * 绑定号码
     *
     * @param json 　ＳＧＳ报文：  "{\"courierPhone\":\"15914085476\",\"customerPhone\":\"18675523334\",\"extendField1\":\"002AAABVYGDxe8feo6mDdZHYKeIwxX5Npzf\",\"msgType\":\"iisp.telephone.bind\",\"sysCode\":\"SGS\",\"transId\":\""+uuid+"\",\"transTimestamp\":\""+strDate+"\"}";
     * @return
     * @throws BindingException
     */
    public String bind(String json) throws BindingException;

    /**
     * 根据条件分页查询
     *
     * @param queryParam
     * @return
     */
    IPage<BindingRecord> findPageBindingRecord(RequestParams queryParam);

    public ReturnBindingInfo convertBindingRecord2ReturnInfo(BindingRecord record);

    /**
     * 根据id查询绑定记录
     *
     * @param id
     * @return
     */
    public BindingRecord loadById(String id);
}
